package com.itheima.rabbitmq.util;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
public class ConnectionUtil {

    public static Connection getConnection() throws Exception {

        ConnectionFactory connectionFactory = new ConnectionFactory();

        connectionFactory.setHost("localhost");

        connectionFactory.setPort(5672);

        connectionFactory.setVirtualHost("/itcast");

        connectionFactory.setUsername("itheima");

        connectionFactory.setPassword("itheima");
        return connectionFactory.newConnection();
    }
}
